package com.dengs.controller;

import com.dengs.dao.UserRepository;
import com.dengs.entity.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
public class UserController {
    @Autowired
    private UserRepository userRepository;

    @GetMapping("/user/{id}")
    @ResponseBody
    public User findById(@PathVariable long id){
        User findOne = this.userRepository.findOne(id);
        return findOne;
    }
}
